<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv=”X-UA-Compatible” content=”IE=edge″/>
    <title>页面</title>
    <script src="https://pinzafile.oss-cn-shanghai.aliyuncs.com/vue-element/loading.js"></script>
    <link href="https://pinzafile.oss-cn-shanghai.aliyuncs.com/vue-element/lib/theme-chalk/index.css" rel="stylesheet">

</head>

<style>
    .el-input {
        width: 100%;
    }
</style>
<body>
<div id="app">
    <el-container v-show="show=='list'" v-loading="loading">
        <el-header>
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">数据中心</el-breadcrumb-item>
                <el-breadcrumb-item>SKU库</el-breadcrumb-item>
            </el-breadcrumb>
        </el-header>
        <el-header>
            <el-row>
                <a href="/dataCenter/skuAdd.page">
                    <el-col :xs="8" :sm="8" :md="4" :lg="2" :xl="2">
                        <el-button type="primary" icon="el-icon-edit" :offset="6">新增</el-button>
                    </el-col>
                </a>
                <el-col :xs="8" :sm="8" :md="4" :lg="2" :xl="2">
                    <el-button type="primary" icon="el-icon-edit" :offset="6" @click=exportSku>导出</el-button>
                </el-col>
                <el-col :xs="14" :sm="14" :md="8" :lg="8" :xl="8">
                    <el-input placeholder="请输入内容" @keyup.enter.native="enterSearch" v-model="keySearch"
                              style="width: 100%">
                        <el-button slot="append" icon="el-icon-search" @click=search></el-button>
                    </el-input>
                </el-col>
            </el-row>
        </el-header>
        <el-main>
            <el-table v-loading="tableLoading" :data="tableData" stripe border style="width:100%" highlight-current-row
                      size="mini"
                      tooltip-effect="dark" height="calc(100vh - 240px)">
                <el-table-column label="序号" align="center" width="50px">
                    <template scope="scope"><span>{{scope.$index+(currentPage - 1) * pageSize + 1}}</span></template>
                </el-table-column>
                <el-table-column prop="sku_code" label="材料编码" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                　　
                <el-table-column prop="sku_name" label="材料名称" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                <el-table-column prop="sku_brand" label="品牌" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                　　
                <el-table-column prop="sku_unit" label="单位" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                <el-table-column prop="sku_model" label="型号" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                <el-table-column prop="sku_slug_set" label="规格参数" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                <el-table-column prop="sku_cost_price" label="成本价格" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                <el-table-column prop="sku_official_price" label="官方价格" align="center" :show-overflow-tooltip=true>
                    　　
                </el-table-column>
                <el-table-column label="操作" align="center" min-width="140px" fixed="right">
                    <template slot-scope="scope">
                        <el-button @click="detail(scope.row.sku_code)" type="text">查看</el-button>
                        <el-button type="text" @click="modify(scope.row.sku_code)">编辑</el-button>
                        <el-button type="text" @click="cancel(scope.row.sku_code)">作废</el-button>
                    </template>
                </el-table-column>

            </el-table>
        </el-main>
        <el-footer>
            <el-row>
                <el-col>
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                                   :page-sizes="[100, 500, 1000]" :page-size="pageSize"
                                   layout="total, sizes, prev, pager, next, jumper"
                                   :total="totalRecords">
                    </el-pagination>
                </el-col>
            </el-row>
        </el-footer>
    </el-container>
    <el-container v-show="show=='detail'">
        <el-header>
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">数据中心</el-breadcrumb-item>
                <el-breadcrumb-item>SKU库</el-breadcrumb-item>
                <el-breadcrumb-item>SKU查看</el-breadcrumb-item>
            </el-breadcrumb>
        </el-header>
        <el-main>
            <el-form ref="SKU" :model="SKU" label-width="120px">
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="SKU编号" prop="sku_code">
                            <el-input v-model="SKU.sku_code" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="SKU名称" prop="sku_name">
                            <el-input v-model="SKU.sku_name" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="单位" prop="sku_unit">
                            <el-input v-model="SKU.sku_unit" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="品牌" prop="sku_brand">
                            <el-input v-model="SKU.sku_brand" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="型号" prop="sku_model">
                            <el-input v-model="SKU.sku_model" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="供货周期" prop="sku_lead_time">
                            <el-input v-model="SKU.sku_lead_time" :disabled="true">
                                <template slot="append">天</template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="成本价格" prop="sku_cost_price">
                            <el-input v-model="SKU.sku_cost_price" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="官方价格" prop="sku_official_price">
                            <el-input v-model="SKU.sku_official_price" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="规格参数">
                            <el-row v-for="sku_slug in SKU.sku_slug_list">
                                <el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
                                    <el-input v-model="sku_slug.sku_spec" :disabled="true"
                                    ></el-input>
                                </el-col>
                                <el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
                                    <el-input v-model="sku_slug.sku_slug" :disabled="true"
                                    ></el-input>
                                </el-col>
                            </el-row>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="图片" prop="sku_pic_url">
                            <img :src="SKU.sku_pic_url" style="max-width:200px">
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="质检报告">
                            <a :href="SKU.sku_file_path" target="_blank">
                                <el-button type="text">{{SKU.sku_file_name}}</el-button>
                            </a>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="备注" prop="sku_content">
                            <el-input type="textarea" v-model="SKU.sku_content" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-form-item>
                    <el-button @click="detailBack">返回</el-button>
                </el-form-item>
            </el-form>
        </el-main>
    </el-container>
    <el-container v-show="show=='update'">
        <el-header>
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">数据中心</el-breadcrumb-item>
                <el-breadcrumb-item>SKU库</el-breadcrumb-item>
                <el-breadcrumb-item>SKU修改</el-breadcrumb-item>
            </el-breadcrumb>
        </el-header>
        <el-main>
            <el-form ref="SKU" :model="SKU" :rules="rules" label-width="120px">
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="SKU编号" prop="sku_code">
                            <el-input :disabled="true" v-model="SKU.sku_code"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="SKU名称" prop="sku_name">
                            <el-input :disabled="true" v-model="SKU.sku_name"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="单位" prop="sku_unit_id">
                            <el-select v-model="SKU.sku_unit_id" filterable placeholder="请选择单位"
                                       :disabled="true" style="width: 100%;">
                                <el-option v-for="unit in unitList" :key="unit.id" :label="unit.unit_name"
                                           :value="unit.id">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="品牌" prop="sku_brand_id">
                            <el-select v-model="SKU.sku_brand_id" filterable placeholder="请选择品牌"
                                       :disabled="true" style="width: 100%;">
                                <el-option v-for="brand in brandList" :key="brand.id"
                                           :label="brand.brand_name"
                                           :value="brand.id">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="型号" prop="sku_model">
                            <el-input v-model="SKU.sku_model" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="供货周期" prop="sku_lead_time">
                            <el-input v-model="SKU.sku_lead_time" :disabled="true">
                                <template slot="append">天</template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="成本价格" prop="sku_cost_price">
                            <el-input v-model.number="SKU.sku_cost_price"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="官方价格" prop="sku_official_price">
                            <el-input v-model.number="SKU.sku_official_price"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            <#--<el-row>-->
            <#--<el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">-->
            <#--<el-form-item label="属性">-->
            <#--<el-button @click="addDomain">新增属性</el-button>-->
            <#--</el-form-item>-->
            <#--</el-col>-->
            <#--</el-row>-->
            <#--<el-row>-->
            <#--<el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">-->
            <#--<el-form-item v-for="(domain, index) in specSlugSet"-->
            <#--:label="'属性' + (index+1)" :prop="'specSlugSet.' + index + '.spec'">-->
            <#--<el-cascader :options="specList" v-model="domain.spec" style="width:100%" filterable-->
            <#--change-on-select :disabled="true">-->
            <#--</el-cascader>-->
            <#--</el-form-item>-->
            <#--</el-col>-->
            <#--</el-row>-->
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="规格参数">
                            <el-row v-for="sku_slug in SKU.sku_slug_list">
                                <el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
                                    <el-input v-model="sku_slug.sku_spec" :disabled="true"
                                    ></el-input>
                                </el-col>
                                <el-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
                                    <el-input v-model="sku_slug.sku_slug" :disabled="true"
                                    ></el-input>
                                </el-col>
                            </el-row>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="图片" prop="SKU.sku_pic_url">
                            <img :src="SKU.sku_pic_url" style="max-width:100px;max_height:100px">
                            <el-upload ref="upload" class="upload-demo" accept=".jpeg,.png,.gif"
                                       action="${url}/uploadController/upload.json" :before-upload="beforeAvatarUpload"
                                       :on-success="handleAvatarSuccess" :on-remove="handleRemove" :on-exceed="onExceed"
                                       multiple :limit="1" list-type="picture-card">
                                <el-button size="small" type="primary">点击上传</el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="质检报告">
                            <a :href="SKU.sku_file_path" target="_blank">
                                <el-button type="text">{{SKU.sku_file_name}}</el-button>
                            </a>
                            <el-upload ref="upload" class="upload-demo"
                                       action="${url}/uploadController/upload.json" :before-upload="beforeAvatarUpload"
                                       :on-success="handleFileSuccess" :on-remove="handleRemove" :on-exceed="onExceed"
                                       multiple :limit="1">
                                <el-button size="small" type="primary">点击上传</el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="16" :md="12" :lg="8" :xl="8">
                        <el-form-item label="备注" prop="sku_content">
                            <el-input type="textarea" v-model="SKU.sku_content" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-form-item>
                    <el-button type="primary" @click="submit('SKU')">提交</el-button>
                    <el-button @click="modifyBack">返回</el-button>
                </el-form-item>
            </el-form>
        </el-main>
    </el-container>
</div>
<script src="https://pinzafile.oss-cn-shanghai.aliyuncs.com/vue-element/dist/vue.js"></script>
<script src="https://pinzafile.oss-cn-shanghai.aliyuncs.com/vue-element/lib/index.js"></script>
<script src="https://pinzafile.oss-cn-shanghai.aliyuncs.com/publiccss/assets/global/plugins/jquery.min.js"
        type="text/javascript"></script>
<script>
    new Vue({
        el: '#app',
        data: function () {
            return {
                tableLoading: false,
                loading: false,
                rules: {
                    sku_code: [{
                        required: true,
                        message: '请输入SKU编号',
                        trigger: 'blur'
                    }],
                    sku_name: [{
                        required: true,
                        message: '请输入SKU名称',
                        trigger: 'blur'
                    }],
                    sku_brand_id: [{
                        required: true,
                        message: '请选择品牌',
                        trigger: 'change'
                    }],
                    sku_unit_id: [{
                        required: true,
                        message: '请选择单位',
                        trigger: 'change'
                    }],
                    sku_cost_price: [{
                        required: true,
                        message: '请输入成本价格',
                        trigger: 'blur'
                    },
                        //     {
                        //     type: 'number',
                        //     message: '价格必须为数字值'
                        // }
                    ],
                    sku_official_price: [{
                        required: true,
                        message: '请输入官方价格',
                        trigger: 'blur'
                    },
                        //     {
                        //     type: 'number',
                        //     message: '价格必须为数字值'
                        // }
                    ],
                },
                tableData: [],
                currentPage: 1, //当前页
                pageSize: 100, //每页总数
                totalRecords: 0, //总条数
                keySearch: '',
                show: "list",
                SKU: {},
                brandList: [],
                unitList: [],
                specList: [],
                specSlugSet: [],
                // fields: ["sku_name", "sku_code", "sku_brand", "sku_unit", "sku_model", "sku_cost_price", "sku_official_price", "sku_pic_url", "sku_slug_set", "sku_system_code", "sku_file_name", "sku_file_path", "sku_content", "sku_lead_time", "sku_model"],
            };

        },

        methods: {
            exportSku() {
                window.location.href = "/dataCenter/sku/export.json?key=" + this.keySearch;
            },
            onExceed(files, fileList) {
                this.$message({
                    type: 'info',
                    message: '最多只能上传一个文件',
                    duration: 6000
                });
            },
            handleRemove(file, fileList) {
                console.log(file, fileList);
            },
            handleAvatarSuccess(data, file) {
                if (data.ret) {
                    this.SKU.sku_pic_url = data.data.data;
                }
            },
            handleFileSuccess(data, file) {
                if (data.ret) {
                    this.SKU.sku_file_name = file.name;
                    this.SKU.sku_file_path = data.data.data;
                }
            },
            beforeAvatarUpload(file) {
                const isLt2M = file.size / 1024 / 1024 < 2;

                if (!isLt2M) {
                    this.$message.error('文件大小不能超过 2MB!');
                }
                return isLt2M;
            },
            submit: function (formName) {
                var SKU = this.SKU;
                SKU.spec_name = [];
                SKU.slug_name = []
                this.specSlugSet.forEach(function (ele) {
                    if (ele.spec.length > 0) {
                        SKU.spec_name.push(ele.spec[0])
                        SKU.slug_name.push(ele.spec[1])
                    }
                });
                SKU.spec_name = SKU.spec_name.toString(",");
                SKU.slug_name = SKU.slug_name.toString(",");
                SKU.requestType = "update";
                SKU.sku_type = "sku";
                delete SKU.create_date;
                console.log(SKU);
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.loading = true;
                        var boolean = false;
                        var msg = '';
                        $.ajax({
                            url: "/dataCenter/skuEdit.json",
                            type: "POST",
                            data: SKU,
                            success: (result) => {
                                this.loading = false;
                                if (result.ret) {
                                    this.$message({
                                        message: '修改成功',
                                        type: 'success'
                                    });
                                    setTimeout(function () {
                                        window.location.href = "/dataCenter/skuIndex.page";
                                    }, 1000);
                                } else {
                                    msg = result.msg;
                                    this.$message.error("操作失败，请稍后重试");
                                }
                            }
                        });
                    } else {
                        this.$message({
                            message: '警告，请填写必填字段',
                            type: 'warning'
                        });
                        return false;
                    }
                });
            },
            removeDomain(item) {
                var index = this.specSlugSet.indexOf(item)
                if (index !== -1) {
                    this.specSlugSet.splice(index, 1)
                }
            },
            addDomain() {
                this.specSlugSet.push({
                    spec: '',
                });
            },
            detailBack: function () {
                this.show = 'list';
            },
            modifyBack: function () {
                this.$refs.upload.clearFiles();
                this.show = 'list';
            },
            getSku(sku_code) {
                $.ajax({
                    url: '/dataCenter/skuDetail.json?sku_code=' + sku_code,
                    type: 'get',
                    success: (result) => {
                        if (result.ret) {
                            this.SKU = result.data
                            // var temp = [];
                            // this.SKU.sku_slug_list.forEach( (element) =>{
                            //     temp.push({
                            //         spec: [parseInt(element.sku_spec_id), parseInt(element.sku_slug_id)]
                            //     })
                            // });
                            // this.specSlugSet = temp;
                            // this.SKU.sku_cost_price = parseInt(this.SKU.sku_cost_price);
                            // this.SKU.sku_official_price = parseInt(this.SKU.sku_official_price);
                        } else {
                            this.$message.error('请求失败，请稍后重试');
                        }
                    }
                });
            },
            //查看
            detail: function (sku_code) {
                this.getSku(sku_code);
                this.show = 'detail';
            },
            //修改
            modify: function (sku_code) {
                this.unitAjax();
                this.brandAjax();
                this.specAjax();
                this.getSku(sku_code);
                this.show = 'update';
            },
            //获取品牌列表
            brandAjax: function () {
                $.ajax({
                    url: '/dataCenter/brandList.json?page=0&limit=0',
                    type: 'get',
                    success: (result) => {
                        if (result.ret) {
                            this.brandList = result.data;
                        } else {
                            this.$message.error('品牌列表请求失败，请稍后重试');
                        }

                    }
                });
            },
            //获取单位列表
            unitAjax: function () {
                $.ajax({
                    url: '/dataCenter/unitList.json?page=0&limit=0',
                    type: 'get',
                    success: (result) => {
                        if (result.ret) {
                            this.unitList = result.data;
                        } else {
                            this.$message.error('单位列表请求失败，请稍后重试');
                        }
                    }
                });
            },
            //获取规格属性列表
            specAjax: function () {
                $.ajax({
                    url: '/dataCenter/specList.json?page=0&limit=0',
                    type: 'get',
                    success: (result) => {
                        if (result.ret) {
                            this.specList = result.data;
                        } else {
                            this.$message.error('规格列表请求异常失败，请稍后重试');
                        }
                    }
                });
            },
            //回车监听事件获取输入内容
            enterSearch: function (event) {
                this.currentPage=1;
                this.pageSize=100;
                this.keySearch = event.target.value;
                this.ajaxFunction()
            },
            //点击事件获取输入内容
            search: function () {
                this.currentPage=1;
                this.pageSize=100;
                this.ajaxFunction()
            },
            //作废
            cancel: function (sku_code) {
                this.$confirm('此操作将永久作废该SKU, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    center: true
                }).then(() => {
                    this.loading = true;
                    this.SKU.requestType = "cancel";
                    this.SKU.sku_code = sku_code;
                    var SKU = this.SKU;
                    $.ajax({
                        url: "/dataCenter/skuEdit.json",
                        type: 'POST',
                        data: SKU,
                        // async: false,
                        success: (result) => {
                            if (result.ret) {
                                this.ajaxFunction();
                                this.$message({
                                    type: 'success',
                                    message: '操作成功!'
                                });
                            } else {
                                this.$message.error('操作失败!');
                            }
                            this.loading = false;
                        }
                    });

                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消操作'
                    });
                });
            },
            handleSizeChange: function (val) {
                this.pageSize = val;
                this.ajaxFunction()
            },
            handleCurrentChange: function (val) {

                this.currentPage = val;
                this.ajaxFunction()
            },
            ajaxFunction: function () {
                this.tableLoading = true;
                let skuList = $.ajax({
                    url: '/dataCenter/skuList.json?page=' + this.currentPage + '&size=' + this.pageSize + '&key=' + this.keySearch,
                    type: 'get',
                    dataType: 'json',
                    timeout: 5000,
                    success: (result) => {
                        if (result.result) {
                            this.tableData = result.data;
                            this.totalRecords = result.count;
                        } else {
                            this.$message.error('请求失败，请稍后重试');
                        }
                    },
                    error: () => {
                        this.$message.error('请求失败，请稍后重试');
                    },
                    complete: (XMLHttpRequest, status) => {
                        if (status == 'timeout') {
                            skuList.abort();
                            this.$message.error('请求超时，请检查网络');
                        }
                        this.tableLoading = false;
                    }
                });

            },
        },
        mounted: function () {
            this.ajaxFunction();
        },
    })
</script>

</body>

</html>